package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.RecommendationBookList;
import com.pgybook.db.entity.domain.RecommendationBookListEx;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

@Repository
public interface RecommendationBookListMapper {
    int countByExample(RecommendationBookListEx example);

    int deleteByExample(RecommendationBookListEx example);

    @Delete({
            "delete from recommendationbooklist",
            "where RBLID = #{rblid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer rblid);

    @Insert({
            "insert into recommendationbooklist (BOOKID, RECOMMID, ",
            "SEQ, CRTTIME, ",
            "CRTSTAFF)",
            "values (#{bookid,jdbcType=BIGINT}, #{recommid,jdbcType=INTEGER}, ",
            "#{seq,jdbcType=INTEGER}, #{crttime,jdbcType=TIMESTAMP}, ",
            "#{crtstaff,jdbcType=INTEGER})"
    })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "rblid", before = false, resultType = Integer.class)
    int insert(RecommendationBookList record);

    int insertSelective(RecommendationBookList record);

    List<RecommendationBookList> selectByExample(RecommendationBookListEx example);

    @Select({
            "select",
            "RBLID, BOOKID, RECOMMID, SEQ, CRTTIME, CRTSTAFF",
            "from recommendationbooklist",
            "where RBLID = #{rblid,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    RecommendationBookList selectByPrimaryKey(Integer rblid);

    int updateByExampleSelective(@Param("record") RecommendationBookList record, @Param("example") RecommendationBookListEx example);

    int updateByExample(@Param("record") RecommendationBookList record, @Param("example") RecommendationBookListEx example);

    int updateByPrimaryKeySelective(RecommendationBookList record);

    @Update({
            "update recommendationbooklist",
            "set BOOKID = #{bookid,jdbcType=BIGINT},",
            "RECOMMID = #{recommid,jdbcType=INTEGER},",
            "SEQ = #{seq,jdbcType=INTEGER},",
            "CRTTIME = #{crttime,jdbcType=TIMESTAMP},",
            "CRTSTAFF = #{crtstaff,jdbcType=INTEGER}",
            "where RBLID = #{rblid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(RecommendationBookList record);
}
